﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jenvin.Library.DataStruct.Algorithm
{
    public class MatchCollection : System.Collections.CollectionBase
    {
        public Match this[string name]
        {
            get
            {
                foreach (object o in List)
                {
                    var result = ((Match)o);
                    if (result != null && string.Compare(name, result.Keyword, true) == 0)
                    {
                        return result;
                    }
                }
                return null;
            }
        }

        public Match this[int index]
        {
            get
            {
                return (Match)List[index];
            }
            set
            {
                List[index] = value;
            }
        }

        public int Add(Match indexer)
        {
            return List.Add(indexer);
        }

        public int IndexOf(Match indexer)
        {
            return List.IndexOf(indexer);
        }
    }
}
